package Ali;

import java.util.HashMap;
import java.util.Scanner;

public class Main_0915_3 {
    public static void main(String[] args) {
        Scanner cin=new Scanner(System.in);
        String line=cin.nextLine();
        int n=line.length();
        if (n<=1) {
            System.out.println(n);
            return;
        }
        //滑动窗口
        HashMap<Character,Integer> window=new HashMap<>();
        int left=0,right=0;
        int jscount=0;
        long res=0;
        while (right<n){
            char c=line.charAt(right);
            right++;
            window.put(c,window.getOrDefault(c,0)+1);
            if (window.get(c)%2==1){
                jscount++;
                while (jscount>1){
                    char d=line.charAt(left);
                    left++;
                    if (window.get(d)%2==1){
                        jscount--;
                    }
                    window.put(d,window.getOrDefault(d,0)-1);
                }
                if (jscount==1){
                    res++;
                }
            }
        }
        System.out.println(res);
    }
}
